package com.zhijian.medical.service;

import com.zhijian.medical.entity.po.ExperimentProcessSample;
import com.zhijian.medical.entity.po.Pcr;
import com.zhijian.medical.entity.vo.request.ExperimentProcessSampleSearchVo;
import com.zhijian.medical.entity.vo.response.ExperimentProcessSampleVo;
import com.zhijian.medical.entity.vo.response.ExperimentTypeEnumVo;
import com.zhijian.medical.util.Page;

import java.util.List;

/**
 * 实验流程-样本管理 业务处理层
 *
 * @author HCG
 * @version 1.0
 * @date 2022-04-13 23:32:04
 */
public interface ExperimentProcessSampleService {

    /**
     * 主键查询
     *
     * @param id
     * @return
     */
    ExperimentProcessSample selectById(Long id);

    /**
     * 根据分子病理号查找
     *
     * @param fzblh
     * @return
     */
    ExperimentProcessSample selectByFzblh(String fzblh);

    /**
     * 主键查询vo
     *
     * @param id
     * @return
     */
    ExperimentProcessSampleVo selectVoById(Long id);

    /**
     * 按照主键删除
     *
     * @param id
     */
    void deleteById(Long id);

    /**
     * 新增
     *
     * @param experimentProcessSample
     * @return
     */
    Long insert(ExperimentProcessSample experimentProcessSample);

    /**
     * 新增多条
     *
     * @param experimentProcessSampleList
     * @return
     */
    boolean insertAll(List<ExperimentProcessSample> experimentProcessSampleList);

    /**
     * 更改
     *
     * @param experimentProcessSample
     * @return
     */
    boolean update(ExperimentProcessSample experimentProcessSample);

    /**
     * 更改
     *
     * @param record
     * @return
     */
    boolean updateByPrimaryKeySelective(ExperimentProcessSample record);

    /**
     * 删除与实验流程的关系
     *
     * @param experimentProcessId
     * @return
     */
    boolean removeRelation(Long experimentProcessId, Byte mainType);

    /**
     * 总数
     *
     * @param experimentProcessSampleSearchVo
     * @return
     */
    Integer count(ExperimentProcessSampleSearchVo experimentProcessSampleSearchVo);

    /**
     * 列表
     *
     * @param experimentProcessSampleSearchVo
     * @return
     */
    List<ExperimentProcessSampleVo> selectList(ExperimentProcessSampleSearchVo experimentProcessSampleSearchVo);

    List<ExperimentProcessSampleVo> fishSampleList();

    /**
     * 分页查询
     *
     * @param experimentProcessSampleSearchVo
     * @return
     */
    Page<ExperimentProcessSampleVo> selectPage(ExperimentProcessSampleSearchVo experimentProcessSampleSearchVo);

    /**
     * 根据id修改备注
     *
     * @param id
     * @param note
     * @return
     */
    boolean updateNoteById(Long id, String note);

    /**
     * 根据年份查找出最大的分子病理号
     *
     * @param year
     * @return
     */
    String selectMaxMoleculePathologyNumberByYear(String year);

    /**
     * 获取下一个分子病理号
     *
     * @return
     */
    String createNextMoleculePathologyNumber();

    /**
     * 根据分子病理号查找
     *
     * @param moleculePathologyNumber
     * @return
     */
    ExperimentProcessSampleVo selectVoByMoleculePathologyNumber(String moleculePathologyNumber);

    /**
     * 组装实验总类型
     *
     * @return
     */
    List<ExperimentTypeEnumVo> selectExperimentTypeEnumVo();

    /**
     * 根据RNA或者DNA查询要样本准备的样本列表
     *
     * @param drType
     * @return
     */
    List<ExperimentProcessSampleVo> selectWaitReady(Integer drType);

    /**
     * 根据RNA或者DNA查询要核酸提取的样本列表
     *
     * @param drType
     * @return
     */
    List<ExperimentProcessSampleVo> selectWaitHstqByType(Integer drType);

    /**
     * 在实验里取消
     *
     * @param id
     * @param cancelReason 取消理由
     * @param handleType   处理方式，0：重新实验，1：退费
     * @return
     */
    boolean cancelInProcess(Long id, String cancelReason, Byte handleType);

    /**
     * PCR实验中，根据不合格的样本生成一个全新的样本
     *
     * @param bhg
     * @return
     */
    boolean createNewFromBhg(ExperimentProcessSample bhg, Pcr pcr);

}